﻿using AutoIt;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo.PTGUI
{
    class AutoItOperation
    {
        public static void SelectAllFiles(string winTitle, string path, int sleep_n)
        {

            AutoItX.ControlFocus(winTitle, "", "Edit1");
            AutoItX.Sleep(sleep_n);
            AutoItX.ControlSetText(winTitle, "", "Edit1", path);
            AutoItX.Sleep(sleep_n);

            AutoItX.ControlClick(winTitle, "", "Button1", "left");
            AutoItX.Sleep(sleep_n);

            AutoItX.ControlFocus(winTitle, "", "DirectUIHWND2");
            AutoItX.Sleep(sleep_n);

            AutoItX.ControlSend(winTitle, "", "DirectUIHWND2", "^a");
            AutoItX.Sleep(sleep_n);

            AutoItX.ControlClick(winTitle, "", "Button1", "left");
            AutoItX.Sleep(sleep_n);
        }

        /**
		 *  
		 */
        //public static void selectAll(ActiveXComponent dm, DesertWindow dmw, DesertKeyMouse dmkm, DesertOperation dmo, AutoItX aix, String winTitle, String classNN, int sleep_n)
        //{

        //	int hwnd = dmw.FindWindow(dm, null, winTitle);
        //	dmw.SetWindowState(dm, hwnd, 1);
        //	dmw.SetWindowState(dm, hwnd, 8);


        //	aix.controlFocus(winTitle, "", classNN);
        //	aix.sleep(sleep_n);

        //	aix.controlClick(winTitle, "", classNN, "left", 1);
        //	aix.sleep(sleep_n);

        //	dmo.keyPressWithCtrl(dm, dmkm, 65);
        //	aix.sleep(sleep_n);

        //	dmw.SetWindowState(dm, hwnd, 9);
        //}
    }
}
